import sys


def tuple__():
    tuple__ = ["学习", "游泳", "工作"]
    # 遍历元组
    for i in tuple__:
        print(i)

    for i in range(len(tuple__)):
        print(tuple__[i])
    print("-----------------")
    print(tuple__[1:2])
    print(tuple__[-1])


def list__():
    # help(list)
    list = {"1", "2"}
    print("2" in list)


def dict__():
    dict = {"apple": "APPle", "O": "中文", "cat": "Cat", "b":"B"}
    dict.pop("b")
    for k in dict:
        print(dict[k])

    for k, v in dict.items():
        print(k, v)
    print(dict.get("b", "已经不存在b"))
    dict.update({"e": "E"})
    print(dict.keys())
    print(dict.values())
    print(dict.items())
    # 根据key排序
    print(sorted(dict.items(), key=lambda d: d[0]))
    # 根据value排序
    print(sorted(dict.items(), key=lambda d: d[1]))

    if "c" in dict:
        print("存在c")


def sys_modules__():
    print(sys.modules.items())
    print(sys.modules.keys())
    print(sys.modules["stat"])

if __name__ == '__main__':
    # tuple__()
    # list__()
    # dict__()
    sys_modules__()
else:
    print("不是主程序入口")



